home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / Online / Miami / MiamiSDK / netinclude / sys / ioccom.h < prev    next >
C/C++ Source or Header  |  1997-12-09  |  1KB  |  30 lines

  1. #ifndef    _SYS_IOCCOM_H_
  2. #define    _SYS_IOCCOM_H_
  3.  
  4. /*
  5.  * Ioctl's have the command encoded in the lower word, and the size of
  6.  * any in or out parameters in the upper word.  The high 3 bits of the
  7.  * upper word are used to encode the in/out status of the parameter.
  8.  */
  9. #define    IOCPARM_MASK    0x1fff        /* parameter length, at most 13 bits */
  10. #define    IOCPARM_LEN(x)    (((x) >> 16) & IOCPARM_MASK)
  11. #define    IOCBASECMD(x)    ((x) & ~(IOCPARM_MASK << 16))
  12. #define    IOCGROUP(x)    (((x) >> 8) & 0xff)
  13.  
  14. #define    IOCPARM_MAX    4096        /* max size of ioctl, mult. of NBPG */
  15. #define    IOC_VOID    0x20000000    /* no parameters */
  16. #define    IOC_OUT        0x40000000    /* copy out parameters */
  17. #define    IOC_IN        0x80000000    /* copy in parameters */
  18. #define    IOC_INOUT    (IOC_IN|IOC_OUT)
  19. #define    IOC_DIRMASK    0xe0000000    /* mask for IN/OUT/VOID */
  20.  
  21. #define    _IOC(inout,group,num,len) \
  22.     (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
  23. #define    _IO(g,n)    _IOC(IOC_VOID,    (g), (n), 0)
  24. #define    _IOR(g,n,t)    _IOC(IOC_OUT,    (g), (n), sizeof(t))
  25. #define    _IOW(g,n,t)    _IOC(IOC_IN,    (g), (n), sizeof(t))
  26. /* this should be _IORW, but stdio got there first */
  27. #define    _IOWR(g,n,t)    _IOC(IOC_INOUT,    (g), (n), sizeof(t))
  28.  
  29. #endif /* !_SYS_IOCCOM_H_ */
  30.